package com.espirit.finance.core;

import java.util.Comparator;

public class DefaultAcctItemCompare implements Comparator<AcctItem> {
	@Override
	public int compare(AcctItem o1, AcctItem o2) {
		Integer nbr1 = o1.getParent().getNbr();
		Integer nbr2 = o2.getParent().getNbr();
		if (nbr1 == null && nbr2 == null) return 0;
		if (nbr1 == null){
			return -1;
		}
		if (nbr2 == null){
			return 1;
		}
		
		return nbr1.compareTo(nbr2);
	}
}
